package homework;

import java.util.HashSet;
import java.util.Set;

//作业标题(2711)
//宝石与石头
//
//作业内容
//宝石与石头
//https://leetcode.cn/problems/jewels-and-stones/description/
public class h2711 {
    public int numJewelsInStones(String jewels, String stones) {
        Set<Character> set = new HashSet<>();
        for(char c : jewels.toCharArray())
        {
            set.add(c);
        }

        int count = 0;
        for(char c : stones.toCharArray())
        {
            if(set.contains(c)) count++;
        }

        return count;
    }
}
